<template>
  <div class="policy list-right">
    <!-- 面包屑-->
    <div class="bread">
      <el-breadcrumb separator=">">
        <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item>政策文件</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="articlePage">
      <div class="list">
        <div v-for="(item,index) in policeList"  :key="item.id" class="list-content">
          <div class="hl-top">
            <div class="hl-right">
              <router-link :to="{name:'policyDetail', query: {id:item.id}}" target="_blank">
                <div class="hl-title">{{ item.title }}</div>
                <div class="hl-txt"><span>{{ item.introduction }}</span></div>
              </router-link>
            </div>
          </div>
          <div class="hl-bottom"><span>时间:&nbsp;&nbsp;{{ parseTime(item.createDate, '{y}-{m}-{d}') }}</span></div>
        </div>
      </div>
    </div>
    <div class="page">
      <pagination
        v-show="total>0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
      />
    </div>
  </div>
</template>

<script>
import { listPolicy } from '@/api/consulte/policy'

export default {
  name: 'PolicyListPage',
  data () {
    return {
      total: 0,
      policeList: [],
      queryParams: {
        pageNum: 1,
        pageSize: 5,
      },
    }
  },
  created () {
    this.getList()
  },
  methods: {
    getList () {
      this.loading = true
      listPolicy(this.queryParams).then(response => {
        this.policeList = response.rows
        this.total = response.total
        this.loading = false
      })
    }
  }
}
</script>

<style lang="scss" scoped>

.articlePage {
  margin-top: 20px;
}

.list-content {
  border-bottom: 1px dashed #666666;
  margin-bottom: 10px;

  .hl-title {
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    color: #333333;
    line-height: 34px;
    margin-bottom: 5px;
    overflow: hidden;
    text-indent: 24px;
  }

  .hl-txt {
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 400;
    color: #666666;
    line-height: 24px;
    overflow: hidden;
    text-indent: 24px;
    margin-bottom: 10px;
  }

  .hl-bottom span {
    font-size: 14px;
    font-weight: 400;
    color: #999999;
    line-height: 24px;

  }

  .hl-bottom {
    text-align: right;
  }
}

.page {
  text-align: center;
  margin-top: 30px;

  ::v-deep .number.active {
    background-color: #337ab7 !important;
  }
}
</style>
